package com.tcse.ppmethodhandler.entity;

import java.util.Objects;

public class ClassRecord extends ClassFileRecord {

    {
        setType();
    }

    @Override
    public void setType() {
        super.type = "class";
    }

    private String classname;
    private String classfile;

    public ClassRecord() {
    }

    public ClassRecord(String classname) {
        this(classname, null);
    }

    public ClassRecord(String classname, String classfile) {
        this.classname = classname;
        this.classfile = classfile;
    }

    public String getClassname() {
        return classname;
    }

    public void setClassname(String classname) {
        this.classname = classname;
    }

    public String getClassfile() {
        return classfile;
    }

    public void setClassfile(String classfile) {
        this.classfile = classfile;
    }

    @Override
    public String toString() {
        return "ClassRecord={" +
                "classname='" + classname + '\'' +
                ", classfile='" + classfile + '\'' +
                ", type='" + type + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ClassRecord that = (ClassRecord) o;
        return Objects.equals(classname, that.classname) &&
                Objects.equals(classfile, that.classfile);
    }

    @Override
    public int hashCode() {
        return Objects.hash(classname, classfile);
    }
}
